const formatTimeMills = () => {
  let date = new Date();
  let timeStr = date.getFullYear() + "-";
  if (date.getMonth() < 9) {
    // 月份从0开始的
    timeStr += "0";
  }
  timeStr += date.getMonth() + 1 + "-";
  timeStr += date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  timeStr += " ";
  timeStr += date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  timeStr += ":";
  timeStr +=
    date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  timeStr += ":";
  timeStr +=
    date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  return timeStr;
};

console.log(formatTimeMills());
